import request from '@/utils/request'

//从配置中获取业务的地址
import {baseUrlConfig} from '@/config/config'
const basePath = baseUrlConfig.businessBaseUrl

interface Order{
  column:string;
  method:string;
}
export interface PageListType {
[x: string]: any;
  pageNum?: number;
  pageSize?: number;
  askTimeStart?: string;
  askTimeEnd?: string;
  recorder?: string;
  askContent?: string;
  type?: any;
  askRegion?: string;
  order?: Array<Order>;
  askType?: any;
}

export const askPageList: (data: PageListType) => Promise<[]> = (data: PageListType) => {
  return request({
    url: basePath + '/pax/ask/find/page',
    method: 'post',
    data: {
      pageNum: data.pageNum,
      pageSize: data.pageSize,
      condition: {
        recorder: data.recorder,
        askContent: data.askContent,
        askRegion: data.askRegion,
        askTimeStart: data.askTimeStart,
        askTimeEnd: data.askTimeEnd,
        type: data.type,
        order: data.order
      }
    }
  })
}

export const asklist: (data: PageListType) => Promise<[]> = (data: PageListType) => {
  return request({
    url: basePath + '/pax/ask/find/page',
    method: 'post',
    data
  })
}

// 导出
export const exportlist: (data: PageListType) => Promise<[]> = (data: PageListType) => {
  return request({
    url: basePath + '/pax/ask/export',
    method: 'post',
    responseType: 'blob',
    data
  })
}
